#ifndef PLAYERCHARACTER_H
#define PLAYERCHARACTER_H

#include "Character.h"
#include "MapManager.h"
#include"GlobalObject.h"

class PlayerCharacter : public Character
{
    Q_OBJECT
public:
    explicit PlayerCharacter(MapManager *mapManager, QObject *parent = nullptr);

    // 更新方法（处理玩家逻辑）
    void update(float deltaTime) override;
    void moveWithCollision(float dx,
                           float dy); // 玩家特定移动（带地形碰撞检测）
    // 输入处理
    void handleInput(bool moveUp, bool moveDown, bool moveLeft, bool moveRight,
                     bool isSprinting);

    // 类型标识
    //QString type() const override { return "Player"; }

    void handleWildEncounter(); // 野外遭遇处理

    QVector<Pokemon *> playerPokemon;

protected:
    void initializeCollisionShape() override; // 初始化碰撞形状（重写基类实现）

signals:
    void wildPokemonEncountered();

private:
    bool checkTerrainCollision(const QPointF &newPos) const;

    MapManager *m_mapManager; // 集成地图以判断位置

    // 输入状态（上下左右，疾跑）
    bool m_moveUp = false;
    bool m_moveDown = false;
    bool m_moveLeft = false;
    bool m_moveRight = false;
    bool m_isSprinting = false;

    // 遭遇计时器
    float m_encounterTimer = 0.0f;
    const float ENCOUNTER_CHECK_INTERVAL = 0.5f;


};

#endif // PLAYERCHARACTER_H
